@extends('layouts.admin')
@section('content')
	{{--<script src="{{asset('css/jquery.js')}}"></script>--}}
	{{--<script src="{{asset('js/jquery.validate.min.js')}}"></script>--}}
	{{--<script src="{{asset('js/messages_zh.js')}}"></script>--}}
	{{--<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>--}}
	{{--<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>--}}
	{{--<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>--}}
	{{--<script>--}}
        {{--$.validator.setDefaults({--}}
            {{--submitHandler: function() {--}}
                {{--alert("提交事件!");--}}
            {{--}--}}
        {{--});--}}
        {{--$().ready(function() {--}}
{{--//            alert(222);--}}
            {{--$("#form").validate(function () {--}}
				{{--alert(333);--}}
            {{--});--}}
        {{--});--}}
	{{--</script>--}}
	<div id="content-header">
				<h1>用户管理</h1>
				<div class="btn-group">
					<a class="btn btn-large tip-bottom" title="Manage Files"><i class="icon-file"></i></a>
					<a class="btn btn-large tip-bottom" title="Manage Users"><i class="icon-user"></i></a>
					<a class="btn btn-large tip-bottom" title="Manage Comments"><i class="icon-comment"></i><span class="label label-important">5</span></a>
					<a class="btn btn-large tip-bottom" title="Manage Orders"><i class="icon-shopping-cart"></i></a>
				</div>
			</div>
			<div id="breadcrumb">
				<a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>用户列表</a>
				<a href="#" class="current">密码修改</a>
			</div>
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">						
						<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-th"></i>
								</span>
							</div>
							<div class="widget-content">
				
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-align-justify"></i>									
								</span>
								<h5>密码修改</h5>
							</div>
							<div id="err" style="color:red"></div>
								<form action="javascript:void(0)" method="post" class="form-horizontal" id="form" />
									<div class="control-group" style="width:500px;margin:0 auto">
										{{csrf_field()}}
										<input type="hidden" name="id" value="{{$admin->id}}">
										<label class="control-label">用户名</label>
										<div class="controls">
											<input type="text" name="username" value="{{$admin->username}}" id="username" required  style="height:40px;text-align:center" disabled="true"/>
										</div>
									</div>
									<div class="control-group" style="width:500px;margin:0 auto">
										<label class="control-label">旧密码</label>
										<div class="controls">
											<input type="password" name="password" value="" id="password" required style="height:40px;text-align:center"/>
										</div>
									</div>
									<div class="control-group" style="width:500px;margin:0 auto">
										<label class="control-label">新密码</label>
										<div class="controls">
											<input type="password" name="pass" value="" id="pass" required style="height:40px;text-align:center"/>
										</div>
									</div>
									<div class="control-group" style="width:500px;margin:0 auto">
										<label class="control-label">确认新密码</label>
										<div class="controls">
											<input type="password" name="repass" value="" id="repass" required style="height:40px;text-align:center"/>
										</div>
									</div>
									<div class="form-actions" style="width:80px;margin:0 auto">
										<button type="submit" id="btnt" class="btn btn-primary" style="width:80px">确认修改</button>
									</div>
								</form>
							</div>
						</div>						
					</div>
				</div>
						</div>
						
					</div>
				</div>
				<div class="row-fluid">
					<div id="footer" class="span12">
						2012 &copy; Unicorn Admin. Brought to you by <a href="https://wrapbootstrap.com/user/diablo9983">diablo9983</a>
					</div>
				</div>
			</div>
			</div>
				<script>
                    var pass = $("#pass");
                    var repass=$("#repass");
                    repass.blur(function () {
                        var p1 = $("#repass").val();
                        var p2 = pass.val();
                        if(p2 != p1){
                            $("#err").html("两次密码不匹配");
                            return false;
                        }
                    });
                    $('#btnt').click(function(){
					var data= $("#form").serialize();
                        $.ajax({
                            type:'post',
                            dataType:'json',
                            data:data,
                            url:'{{url('admin/password/changedit')}}',
                            success:function (data) {
                                if(data.status==0){
                                    layer.alert(data.msg, {icon: 6});
                                    location.href = "{{url('admin/index')}}";
                                }else{
                                    layer.msg(data.msg, {icon: 5});
                                }

                            },
                        });

                    });
                    $("#stat").bind("click",function () {
                        var stat = $("input[name=status]").val();
                        console.log(stat);
                     	if(stat==1){
                            $("#stat").html("\<input type=\"hidden\" name=\"status\" value=\"0\" \>关闭访问");
						}else{
                            $("#stat").html("\<input type=\"hidden\" name=\"status\" value=\"1\" \>开启访问");
						}

						console.log($("#stat").html());
					});

				</script>
@endsection